package com.software.process.now

import com.software.util.{DBTools, SparkSql}
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.{DataFrame, SaveMode}


object SelectByPoll {
  Logger.getLogger("org").setLevel(Level.ERROR)

  def main(args: Array[String]): Unit = {

    val spark = DBTools.getSession("AirQuailty","local")
    val airData = DBTools.redFile("csv","D:\\csv\\date.csv",spark)

    airData.createOrReplaceTempView("beijing_poll")

    val selectByPoll: DataFrame = {
      spark.sql(SparkSql.selectByPoll)
    }

    DBTools.WriteMySql("Select_By_Poll",selectByPoll,SaveMode.Overwrite)
  }
}
